﻿using GDGeek;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MrPP.iot.Guide
{
    public class GuideTarget: MonoBehaviour
    {
        [SerializeField]
        private GameObject point_ = null;


        public Transform getPoint()
        {
            if (point_ == null) {
#if UNITY_EDITOR
                point_ = GameObject.CreatePrimitive(PrimitiveType.Sphere);
#else
                point_ = new GameObject("Point");
#endif
                point_.transform.SetParent(this.transform);
                point_.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            }
            Plane plane = GuidePlane.Instance.plane;
            Vector3 closest = plane.ClosestPointOnPlane(this.transform.position);
         
            point_.transform.position = closest;
            return point_.transform;
        }


      
    }
}